package com.sharecode.stock.service;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.sharecode.stock.repository.StockHistoryDateRepository;
import com.sharecode.stock.utils.DateUtils;
import com.sharecode.stock.vo.stock.StockHistoryDate;

@Service
public class StockHistoryDateService {
	@Autowired
	private StockHistoryDateRepository stockHistoryDateRepository;

	public void update() {
		StockHistoryDate historyDate = new StockHistoryDate();
		historyDate.setId(1L);
		historyDate.setDate(DateUtils.day(1,   DateUtils.FORMAT_YYYY_MM_DD));
		stockHistoryDateRepository.saveAndFlush(historyDate);
	}

	public StockHistoryDate find() {
		return stockHistoryDateRepository.findById(1L).get();
	}
}
